#!/usr/bin/env bash

main()
{
    apt update
    apt -y install openjdk-8-jdk maven nodejs npm mysql-server-5.7 mysql-client-5.7

    npm install -g npm@latest-6

    npm install pm2 -g
    npm install http-server -g

    service mysql start  #left mysql start in container by monitor start script

    change_cmd=`cat <<EOF
    update mysql.user set authentication_string = password('12345678') where user='root' and host='localhost';
    update mysql.user set plugin = 'mysql_native_password' where user='root' and host='localhost';
EOF`

    #echo $change_cmd | mysql -uroot -p
    mysql -uroot  -e "$change_cmd"

    [ -f ~/install_for_monitor.sh ] && rm  ~/install_for_monitor.sh

return 0
}

main
exit 0


